package cn.wh.beans.factory.support;

import cn.wh.beans.factory.config.BeanDefinition;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author wanghao
 * @Date 2022-08-21 1:30
 * @Description: 注册表
 */
public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFactory implements BeanDefinitionRegistry {

    private Map<String, BeanDefinition> map = new HashMap<>();

    @Override
    protected BeanDefinition getBeanDefinition(String beanName) {
        return map.get(beanName);
    }

    @Override
    public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) {
        map.put(beanName, beanDefinition);
    }

    @Override
    public boolean containsBeanDefinition(String beanName) {
        return map.containsKey(beanName);
    }
}
